UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PDEBGD4Wocn5LWA+0K3q8ryrHjSx3Kf+btOhG/rS3Bk=' 
WHERE 
  key_id = '2ca53d7cad97e62fb12844f7fe440388b9ebf163923acef59c756edb9c31f5ae' 
  AND (
    token = 'PDEBGD4Wocn5LWA+0K3q8ryrHjSx3Kf+btOhG/rS3Bk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042