UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AY1zALVNwqr69Ek4Il57u8h5H/Sr3Fd2GDDc9/Vjapg=' 
WHERE 
  key_id = '4be95f5aa69bfaba73b339b3d975224cc527b7095fe8bb514c5a55d09d5c3259' 
  AND (
    token = 'AY1zALVNwqr69Ek4Il57u8h5H/Sr3Fd2GDDc9/Vjapg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017